package statistics;
import java.util.Scanner;
public class statistics {
	public static void main(String[] args){
		Scanner in=new Scanner(System.in);
		System.out.println("请输入字符串，包含各种文件类型的文件名。文件名之间用“,”分隔，：");
		String str=new String();
    	str=in.next();
    	String str1=new String();
    	String str2=new String();
    	int n=1;
    	System.out.print("首写字母变成大写并输出为");
    	String s[]=str.split(",");
    	String[] a=new String[s.length];
    	//int[] b=new int[s.length];
    	for(int i=0;i<s.length;i++){
    		str1=s[i].substring(0,1);
    		str2=s[i].substring(1);
    		str1=str1.toUpperCase();
    		String b1[]=s[i].split("\\.");
    		a[i]=b1[b1.length-1];
    		System.out.print(str1+str2+",");
    	}  /*首写字母变成大写并输出*/
        for(int j=0;j<s.length;j++) {
        	if(a[j]!=null) {
        		for(int k=j+1;k<s.length;k++) {
        			if(a[j].equalsIgnoreCase(a[k])) {
        				n++;
        				a[k]=null;
        			}
        		}
        		System.out.print("\n文件类型为"+a[j]+"的文件个数为"+n);
    			n=1;
        	}
        }
}

	private static int[] toCharArray(String string) {
		// TODO Auto-generated method stub
		return null;
	}
}